package com.example.administrator.until;

import android.provider.Settings;
import android.util.Log;
import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/11/25 0025.
 */

public class XMLHelp
{
    private XmlPullParser mXmlPullParser;

    private static XMLHelp sXMLHelp;
    private XMLHelp(Xml xmlPullParser)
    {
        this.mXmlPullParser = xmlPullParser.newPullParser();//解析xml对象
    }

    public static XMLHelp getInitnation(Xml xmlPullParser)
    {
        return XMLHelp.sXMLHelp = XMLHelp.sXMLHelp != null ? sXMLHelp : new XMLHelp(xmlPullParser);
    }

    public Map<? , ?> getXmlByStringXML( String xmlReader) throws XmlPullParserException
    {
        this.mXmlPullParser.setInput(new StringReader(xmlReader));
        int event =  this.mXmlPullParser.getEventType();

        while (event != XmlPullParser.END_DOCUMENT)
        {
            switch (event)
            {
                case XmlPullParser.START_DOCUMENT:
                    break;
                case XmlPullParser.START_TAG:
                    break;
            }

        }
        return new HashMap<>();
    }

}
